<template>
  <el-container>
    <el-main>
      <el-card shadow="never">
        <el-tabs tab-position="top" @tab-click="tabClick">
          <el-tab-pane label="用户配置">
            <user ref="user"></user>
          </el-tab-pane>

          <el-tab-pane label="系统配置">
            <system ref="system"></system>
          </el-tab-pane>

          <el-tab-pane label="平台配置" v-if="isPlatform">
            <platform ref="platform"></platform>
          </el-tab-pane>
        </el-tabs>
      </el-card>
    </el-main>
  </el-container>
</template>

<script>
import user from './user'
import system from './system'
import platform from './platform'

module.exports = {
  name: "Config",
  components: {
    user,
    system,
    platform
  },
  data() {
    return {
      isPlatform: this.$TOOL.data.get("APP_TENANT_INFO").isPlatform
    };
  },
  mounted() {
    this.$refs.user.getList();
  },
  methods: {
    tabClick(tab) {
      if ('用户配置' === tab.props.label) {
        this.$refs.user.getList();
      } else if ('系统配置' === tab.props.label) {
        this.$refs.system.getList();
      } else if ('平台配置' === tab.props.label) {
        this.$refs.platform.getList();
      }
    }
  }
};
</script>
